import * as constant from './constant'
import { fromJS } from 'immutable'
const defaultState = fromJS({
   articleList: [],
   articlePage: 1
})
export default((state=defaultState,action) => {
  switch(action.type){
    case constant.GET_ARTICL_DATA:
    return state.merge({
        articleList: fromJS(action.articleList)
    })
    case constant.GET_MORE_ARTICLE:
    return state.merge({
        'articleList': state.get('articleList').concat(action.list),
        'articlePage': action.nextPage
    })
    default:
     return state;
  }
})